#0. Prepare execution CC "Application" GET_PATH append-delimiter SET sADOxxPath:(path) CC "AdoScript" FILE_EXISTS file:(sADOxxPath + "curl.exe") IF (exists = 0) { CC "AdoScript" FILE_COPY from:"db:\\curl.exe" to:(sADOxxPath + "curl.exe") } #1. Get context parameter for model to be published CC "Modeling" GET_ACT_MODEL SET nCurrentModelID:(modelid) #2. Generate Modelimage to TEMP file CC "AdoScript" GET_TEMP_FILENAME SET sExportFile:(filename + ".png") CC "Drawing" GEN_GFX_STR modelid:(nCurrentModelID) gfx-format:"png" scale:1.0 CC "AdoScript" FWRITE file:(sExportFile) text:(gfx) base64 #3. Query user-defined tweet text CC "AdoScript" EDITFIELD title:"Tweet text" caption:"Enter your tweet:" IF (ecode = 1) { EXIT } SET sTweetText:(text) #4. Post the tweet CC "AdoScript" GET_TEMP_FILENAME SET sReponseFile:(filename + ".txt") SYSTEM (sADOxxPath + "curl.exe -o \""+sReponseFile+"\" -F \"tweet="+sTweetText+"\" -F \"format=CSV\" -F \"image=@" + sExportFile+";filename=ModelImage.png\" -k https://www.adoxx.org/socialmediahook/twitter_adoxx") #with-console-window #5. Store tweet ID in case of success CC "AdoScript" FREAD file:(sReponseFile) SET sResponse:(text) SET nTweetID: (copy(sResponse, 1, (LEN sResponse)-2)) CC "Core" SET_ATTR_VAL objid:(nCurrentModelID) attrname:"Tweet ID" val:(nTweetID) # save model CC "Core" SAVE_MODEL modelid:(nCurrentModelID) #6. Open Tweet in Browser SYSTEM START ("https://twitter.com/ADOxxTraining/status/" + nTweetID)